$(document).ready(function(){
    $(function(){
        $(".search-box input").focus(function(){
            $(this).parent('div').css('border','1px solid #F5C63E');
        }).blur(function(){
            $(this).parent('div').css('border','1px solid #C0C0C0');
        });
    });
    $(function(){
        $(".state li").click(function(){
            $(this).addClass('active').siblings('li').removeClass('active');
        })
    });
    //付款状态匹配
    var pay = $('table .pay-state').children('p');
    $(pay).each(function(){
        var html=$(this).html();
        if(html=="未付款"){
            $(this).css('background','#4CB1FF');
        }else if(html=="已付款待审核"){
            $(this).css('background','#40C62E');
            $(this).parent().siblings().children('.add-record').remove();
        }else if(html=="部分付款"){
            $(this).css('background','#40C62E');
        }else if(html=="已付款"){
            $(this).css('background','#40C62E');
            $(this).parent().siblings().children('.add-record').remove();
        }
    });
    //w调用日期选择插件
    $('#datePicker').daterangepicker();
    $('body').on('click','.applyBtn',function(){
        var date = $('#datePicker').val();
        console.log(date);
        arr=date.split(" - "); 
        var startDate = arr[0];
        var endDate = arr[1];
       $("#startdate").val(startDate);
       $("#enddate").val(endDate);
       console.log(startDate,endDate);
       window.location.href = "/DistributorSystem/finance/findAllRefundRecordList?start="+startDate+"&end="+endDate;
    });
    
  //搜索商品
    $('.search-box span').click(function(){
        var keyWord=$(this).siblings('input').val();
        console.log(keyWord);
        window.location.href = "/DistributorSystem/finance/findAllRefundRecordList?condition="+keyWord;
    });
});

